package com.xiaomaoaixue.wecom.service.impl;

import com.xiaomaoaixue.common.core.utils.StringUtils;
import com.xiaomaoaixue.common.redis.service.RedisService;
import com.xiaomaoaixue.constant.Constants;
import com.xiaomaoaixue.constant.WeConstans;
import com.xiaomaoaixue.wecom.domain.WeCorpAccount;
import com.xiaomaoaixue.wecom.service.IWeCorpAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service;

import java.util.Optional;
import java.util.concurrent.TimeUnit;

/**
 * 企业id相关配置Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-08-24
 */
@Service
@EnableConfigurationProperties(WeCorpAccount.class)
public class WeCorpAccountServiceImpl implements IWeCorpAccountService {

    /*@Autowired
    private RedisService RedisService;*/

    @Autowired
    WeCorpAccount weCorpAccount;

    /**
     * 获取有效的企业id
     * 原代码是从数据库获取，现改为从配置文件中绑定， 为了不破坏原有结构，方法依然保留
     * @return 结果
     */
    @Override
    public WeCorpAccount findValidWeCorpAccount() {
        return weCorpAccount;
    }


    /**
     * 通过企业id查询配置信息  ** 修改或者删除配置时记得删除缓存  **
     * 原代码是从数据库获取且多企业管理，先为一个企业微信， 为了不破坏原有结构，方法依然保留
     * @param corpId 企业id
     * @return
     */
    @Override
    public WeCorpAccount getCorpAccountByCorpId(String corpId) {
        return weCorpAccount;
    }
}
